import QtQuick 2.0
import QtQuick.Window 2.0

Window {
    id:root
    visible: true
    width: 640
    height: 480
    //color: "blue"
    title: qsTr("Hello World")

    Rectangle{
        id:add
        x:0;y:0;
        width: 50
        height: 20
        radius: 20
        color:"steelblue"
        property real speed_value: 0
        Text{
            anchors.centerIn: parent
            text:"+10"
        }

        MouseArea{
            anchors.fill: parent
            onClicked:
                add.speed_value+=10
        }
    }

    Rectangle{
        id:minus
        x:50;y:0;
        width: 50
        height: 20
        radius: 20
        color:"gray"
        property real speed_value: 0
        Text{
            anchors.centerIn: parent
            text:"-10"
        }

        MouseArea{
            anchors.fill: parent
            onClicked:
                add.speed_value-=10
        }
    }

    Meter{
        anchors.centerIn: parent   //锚定到窗口中心
        width: Math.min(root.width,root.height)/2
        height: Math.min(root.width,root.height)/2
        meterMaxValue: 500
        meterMinValue: -500
        underMeterText: "V"
        meter_value: add.speed_value
    }
}
